// 封装的 element-ui 的 Message 插件
import { Message } from 'element-ui'
function _message(message = '网络延迟请稍后重试', type) {
  Message({
    message,
    type: type,
    duration: 5 * 1000
  })
}
function $errorMessage(message) {
  _message(message, 'error')
}
function $warningMessage(message) {
  _message(message, 'warning')
}

export default {
  install(Vue) {
    Vue.prototype.$errorMessage = $errorMessage
    Vue.prototype.$warningMessage = $warningMessage
  },
  $errorMessage,
  $warningMessage
}
